<template>
  <!--热门搜索-->
  <div class="hotBotList">
    <ul>
      <li v-for="(val,index) in hostInfo" :key="index" @click="skipGrabble('GrabbleType1',val.searchWord)">
        <span class="red">{{index+1}}</span>
        <span>{{val.searchWord}}</span>
        <img :src="val.iconUrl" alt width="20px" height="12px" v-if="val.iconUrl" />
        <span class="hui">{{val.score.toString().slice(0,2)}}万</span>
      </li>
    </ul>
  </div>
</template>

<script>
import hotRequire from "requests/grabble";
export default {
  data() {
    return {
      hostInfo: null
    };
  },
  methods: {
    getHostList() {
      hotRequire.hotBot().then(res => {
        this.hostInfo = res.data.data.slice(0, 6);
        //console.log(this.hostInfo)
      });
    },
    skipGrabble(path, val) {
      this.$router.push({
        name: path,
        query: {
          keyWord:val
        }
      });
    }
  },
  mounted() {
    this.getHostList();
  }
};
</script>

<style scoped lang='less'>
.hotBotList {
  ul {
    padding: 0px;
    font-size: 16px;
    color: #000;
    li {
      padding-left: 10px;
      padding: 15px 0;
      cursor: pointer;
      span {
        margin-left: 6px;
      }
      span.red {
        color: rgb(247, 68, 68);
      }
      span.hui {
        color: #ff9900;
        font-size: 12px;
        float: right;
        margin-right: 10px;
      }
    }
    li:hover {
      background: #31c27c;
      color: #fff;
    }
  }
}
</style>